package fanxing;

/**
 * 通过Object来实现泛型
 */
public class obj_fanxing {
    Object a;
    Object b;
    public Object getA() {
        return a;
    }
    public void setA(Object a) {
        this.a = a;
    }
    public Object getB() {
        return b;
    }
    public void setB(Object b) {
        this.b = b;
    }
    public static void main(String[] args){
        obj_fanxing f1=new obj_fanxing();
        f1.setA(30.3f);//实型常量默认是double型，要在后面加f才能转为float型
        float a=(float)f1.getA();//父类不会自动转换子类类型，所以要强制转换
        System.out.println(a);
    }
}
